package com.hundsun.cprs.yyt.service.dilivery.enums;

import java.util.HashMap;
import java.util.Map;

public enum EnumDiliveryType {

	DELIVERY("0", "物流"), ENTRUST("1", "委售"),SELFTGET("2","自提");

	private String value;
	private String description;

	private EnumDiliveryType(String value, String description) {
		this.value = value;
		this.description = description;
	}

	/**
	 * 全局索引池
	 */
	private static Map<String, EnumDiliveryType> pool = new HashMap<String, EnumDiliveryType>();
	static {
		for (EnumDiliveryType et : EnumDiliveryType.values()) {
			pool.put(et.value, et);
		}
	}

	/**
	 * 根据内容索引
	 * 
	 * @param code
	 * @return
	 */
	public static EnumDiliveryType indexByValue(String code) {
		return pool.get(code);
	}

	public String getValue() {
		return value;
	}

	public String getDescription() {
		return description;
	}

	public static Map<String, String> toMap() {
		Map<String, String> enumDataMap = new HashMap<String, String>();
		for (EnumDiliveryType institution : EnumDiliveryType.values()) {
			enumDataMap.put(institution.getValue(), institution.getDescription());
		}
		return enumDataMap;
	}
}
